/**
 * 
 */
package com.redside.webapp.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.redside.model.Business;
import com.redside.service.GenericManager;

/**
 * @author <a href="mailto:pchapman@easystreet.net">Peter Chapman</a>
 *
 */
public class BusinessController implements Controller {

	private final Log logger = LogFactory.getLog(BusinessController.class);
	private GenericManager<Business,Long> businessManager=null;
	
	public void setBusinessManager(GenericManager<Business,Long> businessManager){
		this.businessManager=businessManager;
	}

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		logger.debug("handling request...");
		return new ModelAndView().addObject("businessList", businessManager.getAll());
	}

}
